<%@ page language="java" pageEncoding="UTF-8"%><%request.setAttribute("ctx", request.getContextPath()); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/pub/frontHead.jsp" %>
</head>
<body>    
<%@ include file="slice/topMenu.jsp"%>
    <div class="center">
    	<div class="login" id="loginJs">
        	<div class="login_lf">
            	<h1>注册贝婴轩</h1>
                <form id="registForm">
                <p class="login_p">
                	<input type="text" value="电子邮箱" class="login_mail" keyword="电子邮箱" id="uid" name="uid" onkeyup="checkAccount();"/>&nbsp;&nbsp;<a href="javascript:checkAccount();"><font color="blue">检测</font></a><font color="green" style="display:none;" id="canUse">&nbsp;&nbsp;可用</font><font color="red" style="display:none;" id="used">&nbsp;&nbsp;已注册</font>
                </p>
                <p class="login_p">
                	<input type="password"  class="login_psd"  id="pwd" name="pwd" />
                </p>
                <p class="login_p">   
                    <input type="text" value="昵称" class="login_nick" keyword="昵称"  id="name" name="name" />
                </p>
                <p class="login_p">
                   	<input type="radio" checked="checked" name="gender" /> 女
                    <input type="radio" name="gender" /> 男
                </p> 
                <p class="login_p">  
                    <a href="javascript:regist();" class="button">立即注册</a>
                </p>
                <p class="login_p">        
                    <input type="checkbox" checked="checked" class="float_lf login_checkbox" id="agree"/><span  class="float_lf top5">同意婴贝轩注册条款</span>
                 </p>
                </form>
            </div>
            <div class="login_rg">
            	<p>如果您已经有婴贝轩账号请<a href="javascript:viewLogin();" title="登录">&nbsp;登&nbsp;录</a></p>
<!--                 <p>你还可以用以下方式直接登录：</p> -->
<!--                 <div class="login_links">                	 -->
<!--                     <a class="login_qq2" href="javascript:loginQQ();" title="QQ">qq</a> -->
<!--                     <a class="login_sinaweibo" href="javascript:alert('开发中...');" title="新浪微博">新浪微博</a> -->
<!--                     <a class="login_taobao" href="javascript:alert('开发中...');" title="淘宝">淘宝</a> -->
<!--                     <span id="mm" class="login_more" style="display:none;"> -->
<!--                         <a class="login_renren" href="javascript:alert('开发中...');" title="人人">人人</a> -->
<!--                         <a class="login_wangyi" href="javascript:alert('开发中...');" title="网易" >网易</a> -->
<!--                         <a class="login_txweibo" href="javascript:alert('开发中...');" title="腾讯微博">腾讯微博</a> -->
<!--                         <a class="login_douban" href="javascript:alert('开发中...');" title="豆瓣">豆瓣</a> -->
<!--                         <a class="login_baidu" href="javascript:alert('开发中...');" title="百度">百度</a> -->
<!--                     </span> -->
<!--                     <a href="javascript:" class="login_check_more" title="更多" id="loginMore">更多&gt;&gt;</a> -->
<!--                 </div> -->
            </div>
        </div>
    </div>
<%@ include file="slice/footer.jsp"%>
<script type="text/javascript" src="${ctx}/front/js/ybxJs.js"></script>
<script type="text/javascript">
<!--
//进入登录页面
function viewLogin(){
	location.href="${ctx}/frontSys!viewLogin.action";
}
//检测帐号
function checkAccount(){	
	if ($("#uid").val().length<6){
		return;
	}
	$.post("${ctx}/frontSys!checkAccount.action", "uid="+$("#uid").val() ,function callback(txt){   
		var json = $.parseJSON(txt);   
		if (json.code==0) {					
			$("#canUse").hide();
			$("#used").show();
		}else{
			$("#canUse").show();
			$("#used").hide();			
		}
	}); 
}
//注册
function regist(){
	if ($("#uid").val()== ""||$("#uid").val()=='电子邮箱'){
		alert('电子邮箱不能为空！');
		return;
	}
	if ($("#pwd").val() == ""){
		alert('密码不能为空！');
		return;
	}
	if ($("#uid").val().length<6){
		alert('电子邮箱长度至少6位！');
		return;
	}
	if ($("#pwd").val().length<6){
		alert('密码长度至少6位！');
		return;
	}
	if(!$("#agree").attr("checked")){
		alert('必须同意注册条款！');
		return;
	}
	$.post("${ctx}/frontSys!checkAccount.action", "uid="+$("#uid").val() ,function callback(txt){   
		var json = $.parseJSON(txt);   
		if (json.code==0) {					
			$("#canUse").hide();
			$("#used").show();
		}else{
			$.post("${ctx}/frontSys!regist.action", $("#registForm").serialize() ,function callback(txt){   
				var json = $.parseJSON(txt);   
				if (json.code==0) {					
					location.href="${ctx}/front!viewIndex.action";					
				}else{
					alert('注册失败！');
				}
			}); 
		}
	});
}
//-->
</script>
</body>
</html>